package com.luozengliang.exam.factory;

import com.luozengliang.exam.entity.Apple;
import com.luozengliang.exam.entity.Fruit;
import com.luozengliang.exam.entity.Mango;
import com.luozengliang.exam.entity.Strawberry;

import java.math.BigDecimal;

/**
 * 水果工厂类
 */
public class FruitFactoryA implements AbstractFactory {
    @Override
    public Fruit getFruit(String name, BigDecimal unitPrice, BigDecimal weight){
        if("苹果".equals(name)){
            return new Apple(name,unitPrice,weight);
        }else if("草莓".equals(name)){
            return new Strawberry(name,unitPrice,weight);
        }else if("芒果".equals(name)){
            return new Mango(name,unitPrice,weight);
        }
        return null;
    }
}
